Class pyglet.resource.Location

Known Subclasses:
FileLocation, URLLocation, ZIPLocation

Abstract resource location.

Given a location, a file can be loaded from that location with the open method. This provides a convenient way to specify a path to load files from, and not necessarily have that path reside on the filesystem.

Methods

file object open(self, filename, mode='rb')
Open a file at this location.

Method Details

open

open(self, filename, mode='rb')
Open a file at this location.
Parameters:
filename : str
The filename to open. Absolute paths are not supported. Relative paths are not supported by most locations (you should specify only a filename with no path component).
mode : str
The file mode to open with. Only files opened on the filesystem make use of this parameter; others ignore it.
Returns: file object